import {
  ErrorRequestHandler,
  Request,
  Response,
  NextFunction,
  response,
} from "express";
export default function zjj(req: Request, res: Response, next: NextFunction) {
  Object.defineProperty(response, "info", {
    configurable: true,
    enumerable: true,
    writable: true,
    value: function (
      status: number = 0,
      msg: string = "ok",
      data: object | null = null
    ) {
      response.send({
        status,
        msg,
        data,
      });
    },
  });
  next();
  return;
}
export function info(res: Response, msg: string, data: object | null = null) {
  res.status(200).send({
    status: 0,
    msg,
    data,
  });
  return;
}

export function err(
  res: Response,
  msg: string,
  data: object | null = null,
  status: number = 1
) {
  res.send({
    status,
    msg,
    data,
  });
}
